package net.adetech.crj.entity;

import java.io.Serializable;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Appointment implements Serializable {
    private long appointmentId;
    private String realName;
    private String idType;
    private String idNumber;
    private String state;
    private Timestamp createTime;
    private Timestamp updateTime;
    private String applyUserId;
    private String hallId;
    private String dayId;
    private int timePeriod;
    private String applyId;
    private String serviceType;
    private String hallName;
    private String phoneNumber;

    public long getAppointmentId() {
        return appointmentId;
    }

    public void setAppointmentId(long appointmentId) {
        this.appointmentId = appointmentId;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getIdType() {
        return idType;
    }

    public void setIdType(String idType) {
        this.idType = idType;
    }

    public String getIdNumber() {
        return idNumber;
    }

    public void setIdNumber(String idNumber) {
        this.idNumber = idNumber;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    public Timestamp getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Timestamp updateTime) {
        this.updateTime = updateTime;
    }

    public String getApplyUserId() {
        return applyUserId;
    }

    public void setApplyUserId(String applyUserId) {
        this.applyUserId = applyUserId;
    }

    public String getHallId() {
        return hallId;
    }

    public void setHallId(String hallId) {
        this.hallId = hallId;
    }

    public String getDayId() {
        return dayId;
    }

    public void setDayId(String dayId) {
        this.dayId = dayId;
    }

    public int getTimePeriod() {
        return timePeriod;
    }

    public void setTimePeriod(int timePeriod) {
        this.timePeriod = timePeriod;
    }

    public String getApplyId() {
        return applyId;
    }

    public void setApplyId(String applyId) {
        this.applyId = applyId;
    }

    public String getServiceType() {
        return serviceType;
    }

    public void setServiceType(String serviceType) {
        this.serviceType = serviceType;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public String getTimeName() {
        String result = "";
        try {
            Date date = new SimpleDateFormat("yyyyMMdd").parse(this.dayId);
            Calendar calendar = Calendar.getInstance();
            calendar.setTime(date);
            int year = calendar.get(Calendar.YEAR);
            int month = calendar.get(Calendar.MONTH) + 1;
            int day = calendar.get(Calendar.DAY_OF_MONTH);
            String dateString = year + "年" + month + "月" + day + "日  ";
            String timeString = "";
            if (timePeriod==0)
            {
                timeString ="09:00 - 10:00";
            }
            else if (timePeriod==1)
            {
                timeString ="10:30 - 11:30";
            }
            else if (timePeriod==2)
            {
                timeString ="14:00 - 15:00";
            }
            else if (timePeriod==3)
            {
                timeString ="15:30 - 16:30";
            }
            result = dateString+timeString;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return result;
    }


    public String getHallName() {
        return hallName;
    }

    public void setHallName(String hallName) {
        this.hallName = hallName;
    }

    public String getServiceName() {
        if ("A".equals(this.serviceType))
        {
            return "公民业务";
        }
        else if ("B".equals(this.serviceType))
        {
            return "境外业务";
        }
        else {
            return "综合业务";
        }
    }
    public String getRealNameMask()
    {
        if (this.realName!=null&&this.realName.length()>0&&this.realName.indexOf(" ")<0)
        {
            return "*"+this.realName.substring(1);
        }
        else if (this.realName.indexOf(" ")>0)
        {
            return this.realName.substring(0,this.realName.indexOf(" "));
        }
        return this.realName;
    }

    public String getIdNumberMask()
    {
        if (this.idNumber!=null&&this.idNumber.length()==18)
        {
            return this.idNumber.substring(0,6)+"******"+ this.idNumber.substring(12);
        }
        return this.idNumber;
    }

}
